<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta content="" charset="UTF-8">
    <title>测试</title>
    <script language="javascript" type="text/javascript">
            function p1(){
            document.getElementById("q1").innerHTML="";
            document.getElementById("q2").innerHTML="";
            var elementById = document.getElementById("from");
            var name = document.getElementById("name").value;
            var pw = document.getElementById("pw").value;

            if(name===""){
                document.getElementById("q1").innerHTML="用户名不能为空！";
                return;
            }
            if(name==="admin"){
                if(pw==="123"){
                    elementById.setAttribute("action","/web03/requestDemo05");
                    // window.location.href ='/web03/requestDemo05';
                }else{
                    document.getElementById("q2").innerHTML="密码错误！";
                }
            }else{
                document.getElementById("q1").innerHTML="用户名错误！";
            }
        }

    </script>

</head>
<body>
<!--    测试请求方式获取参数-->
<!--    <form action="/requestDemo02" method="post">-->
<!--    <form action="/web03/requestDemo04" method="post">-->
<form action="/web03/requestDemo05" method="post" id="form">
        用户名：<input type="text" name="username" id="name"> <span id ="q1"></span><br><br>
        密码：<input type="text" name="password" id="pw"><span id ="q2"></span><br>
        <input type="submit" value="登录">
    </form>
</body>
</html>